package com.cn.intelligence.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cn.intelligence.mapper.TbContentMapper;
import com.cn.intelligence.pojo.EUDataGridResult;
import com.cn.intelligence.pojo.TbContent;
import com.cn.intelligence.pojo.TbContentExample;
import com.cn.intelligence.service.ContentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Service
public class ContentServiceImpl implements ContentService {
	
	@Autowired
	public TbContentMapper contentMapper;

	@Override
	public EUDataGridResult getQueryList(Integer page, Integer rows) {
        TbContentExample tbContentExample = new TbContentExample();
        // 分页查询
        PageHelper.startPage(page,rows);
        List<TbContent> tbContentList= contentMapper.selectByExample(tbContentExample);
        // 获取总数
        PageInfo<TbContent> pageInfo = new PageInfo<TbContent>(tbContentList);
        // 实现返回值设定
        EUDataGridResult euDataGridResult = new EUDataGridResult();
        euDataGridResult.setRows(tbContentList);
        euDataGridResult.setTotal(pageInfo.getTotal());
        return euDataGridResult;


    }

}
